package studentdemo.server;

import studentdemo.dao.StudentDao;
import studentdemo.dao.StudentDaoImpl;
import studentdemo.modul.Student;
import java.util.List;

public class StudentService {
    private final StudentDao studentDao = new StudentDaoImpl();

    public boolean addStudent(Student student) {
        return studentDao.insertStudent(student) > 0;
    }

    public boolean updateStudent(Student student) {
        return studentDao.updateStudent(student) > 0;
    }

    public boolean deleteStudent(String sno) {
        return studentDao.deleteStudent(sno) > 0;
    }

    public Student getStudentById(String sno) {
        return studentDao.getStudentById(sno);
    }

    public List<Student> getStudentsByName(String name) {
        return studentDao.getStudentsByName(name);
    }

    public List<Student> getStudentsByPage(int page, int pageSize) {
        return studentDao.getAllStudents(page, pageSize);
    }

    public int getStudentCount() {
        return studentDao.getStudentCount();
    }
} 